package com.share.TAM;

import java.text.SimpleDateFormat;

import javax.management.Notification;
import javax.management.NotificationListener;

/**
 * RI MBean的监听处理器
 * @author zhenzhen
 *
 */
public class RiNotificationListener implements NotificationListener {

	@Override
	public void handleNotification(Notification notification, Object arg1) {
		log("--------------------------");
		log("SequenceNumber:" + notification.getSequenceNumber());
		log("Type:" + notification.getType());
		log("Message:" + notification.getMessage());
		log("Source:" + notification.getSource());
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		log("TimeStamp:" + dateFormat.format(notification.getTimeStamp()));
		log("UserData:" + notification.getUserData());
		log( notification.toString());
	}
	
	private void log(String message) {   
        System.out.println(message);   
    }

}
